<template>
  <!-- <h1>学生社会关系</h1> -->
  <s-table
    size="default"
    :pageURI="false"
    :columns="columns"
    :data="loadData"
    :alert="false"
    :pagination="{ pageSize: 10 }"
  >
    <template slot="csny" slot-scope="a">
      {{ a && a.slice(0, 11) }}
    </template>
  </s-table>
</template>

<script>
import { STable } from '~'

export default {
  props: ['xh', 'checked'],
  components: {
    STable
  },
  data () {
    return {
      columns: [
        {
          title: this.$t('key.name'),
          dataIndex: 'cyxm'
        },
        {
          title: this.$t('key.relation'),
          dataIndex: 'gxmc'
        },
        {
          title: this.$t('key.birthDate'),
          scopedSlots: { customRender: 'csny' },
          dataIndex: 'csny'
        },
        {
          title: this.$t('key.politicalLandscape'),
          dataIndex: 'zzmmmc'
        },
        {
          title: this.$t('key.workUnit'),
          dataIndex: 'cygzdw'
        },
        {
          title: this.$t('key.position'),
          dataIndex: 'cymc'
        },
        {
          title: this.$t('key.contactNumber'),
          dataIndex: 'lxdh'
        }
      ],
      loadData: parameter => {
        // parameter.pageNum = parameter.pageNo
        // let params = Object.assign(this.queryParam, parameter)
        if(this.checked){
          return this.$api.student.studentBcFamily(this.xh).then(res => {
            return {
              data: res.data,
              pageNo: parameter.pageNo,
              pageSize: parameter.pageSize,
              totalPage: 1,
              totalCount: 1
            }
          })
        }else{
          return this.$api.student.studentFamily(this.xh).then(res => {
            return {
              data: res.data,
              pageNo: parameter.pageNo,
              pageSize: parameter.pageSize,
              totalPage: 1,
              totalCount: 1
            }
          })
        }
      }
    }
  }
}
</script>

<style>

</style>
